package org.finesys.boot.service.impl;

import lombok.RequiredArgsConstructor;
import org.finesys.common.core.module.R;
import org.finesys.system.api.entity.SysDictItem;
import org.finesys.system.api.service.DictService;
import org.finesys.system.service.SysDictItemService;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@Service
@RequiredArgsConstructor
public class DictServiceImpl implements DictService {
    private final SysDictItemService sysDictItemService;

    /**
     * 通过字典类型查找字典
     *
     * @param type 字典类型
     * @return 同类型字典
     */
    public R<List<SysDictItem>> getDictByType(@PathVariable("type") String type) {
        return R.success(sysDictItemService.findType(type));
    }

}
